#include "HudRadar.h"

HudRadar g_pHudRadar;

void HudRadar::Init()
{
	Active = true;
	FirstOffset = *(DWORD*) (FindPattern::Find((DWORD) GetModuleHandle(L"client.dll"), 0x89B000, (BYTE*)"\xA1\x00\x00\x00\x00\x85\xC0\x74\x06\x05", "x????xxxxx") + 1);
	SecondOffset = *(DWORD*) (FindPattern::Find((DWORD) GetModuleHandle(L"client.dll"), 0x89B000, (BYTE*)"\x8A\x84\x37\x00\x00\x00\x00\x5F\x5E\x5D\xC2\x04\x00", "xxx????xxxxxx") + 3);
}

void HudRadar::Enable()
{
	this->Active = true;
}

void HudRadar::Disable()
{
	this->Active = false;
}

void HudRadar::Set( bool Active )
{
	this->Active = Active;
}

void HudRadar::Compute()
{
	if (Active)
	{
		if (*(DWORD*)FirstOffset)
		{
			BYTE* Players = (BYTE*) (*(DWORD*)FirstOffset + SecondOffset);
			for (int i = 0; i < 32; i++)
			{
				Players[i] = 1;
			}
		}
	}
}
